/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view.leftPanels;

import controller.Data;
import controller.TableSingleton;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JComboBox;
import view.centerPanels.NewTableCentralPanel;
import view.main.MainGUI;

/**
 *
 * @author Vlada
 */
public class AtributeNamesLeftPanel extends javax.swing.JPanel {

    /**
     * Creates new form AtributeNamesLeftPanel
     */
    public AtributeNamesLeftPanel() {
        initComponents();
     
        Vector cmbOptions = new Vector();
        cmbOptions.add("numeric");
        cmbOptions.add("nominal");
        for (int i = 0; i < NewTablePnlLeft.numOfColumns; i++) {
            TextField txtField = new TextField(10);
            TableSingleton.getInstance().getTextFields().add(txtField);
            TableSingleton.getInstance().getComboBoxes().add(new JComboBox(cmbOptions));

            this.add(TableSingleton.getInstance().getTextFields().get(i));
            this.add(TableSingleton.getInstance().getComboBoxes().get(i));

        }
        JButton ok = new JButton("Ok");
        JButton back = new JButton("Back");
        this.add(ok);
        this.add(back);

        ok.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                ConfirmTableLeftPanel panelLeft = new ConfirmTableLeftPanel();
                panelLeft.setSize(MainGUI.getInstance().getPnlLeft().getSize());
                MainGUI.getInstance().getPnlLeft().removeAll();
                MainGUI.getInstance().getPnlLeft().add(panelLeft);

                NewTableCentralPanel panelCenter = new NewTableCentralPanel();
                panelCenter.setSize(MainGUI.getInstance().getPnlCenter().getSize());
                MainGUI.getInstance().getPnlCenter().removeAll();
                MainGUI.getInstance().getPnlCenter().add(panelCenter);
                
                MainGUI.getInstance().validate();
                MainGUI.getInstance().repaint();

                panelLeft.setVisible(true);
                panelCenter.setVisible(true);
            }
        });
    }

    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
